<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * Class CreateUserInvoicesTable.
 */
class CreateUserInvoicesTable extends Migration
{
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('user_invoices', function(Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->comment('用户id');
            $table->tinyInteger('invoice_message')->default(1)->comment('发票信息 1、个人 2、企业');
            $table->tinyInteger('invoice_type')->default(1)->comment('增值税发票类型 1、普通发票 2、专用发票');
            $table->string('invoice_title',64)->comment('寄送发票抬头');
            $table->string('tax_code',64)->comment('税号');
            $table->string('invoice_address',64)->comment('开票地址');
            $table->string('invoice_tel',64)->comment('开票电话');
            $table->string('invoice_bank',64)->comment('开票开户银行');
            $table->string('invoice_account',64)->comment('开票银行账户');
            $table->string('post_address', 64)->nullable()->comment('寄送地址');
            $table->string('post_contacts',64)->nullable()->comment('联系人');
            $table->string('post_tel',32)->nullable()->comment('快递联系人手机号');
            $table->tinyInteger('is_default')->default(1)->comment('是否是默认  0：否  1：是');
            $table->string('remark')->nullable()->comment('备注');

            $table->timestamps();
            $table->softDeletes();
            $table->index('user_id');
            $table->engine = 'InnoDB';
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('user_invoices');
	}
}
